import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/**
 * 图片与icon
 */
class IconWidget extends StatelessWidget {
  IconWidget({
    Key? key,
    @required this.text,
  }) : super(key: key);
  final String? text;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        backgroundColor: Colors.grey[300], //背景色

        appBar: AppBar(
          title: Text(text ?? ""),
        ),
        body: new Column(
          //居中

          // mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            new Align(
                alignment: Alignment.center,
                heightFactor: 2.0,
                child: Image.asset(
                  "images/icon_card.jpg",
                  width: 50.0,
                  height: 50.0,
                )),
            new Align(
                alignment: Alignment.center,
                heightFactor: 2.0,
                child: Image(
                  image: NetworkImage(
                      "https://www.wanandroid.com/blogimgs/50c115c2-cf6c-4802-aa7b-a4334de444cd.png"),
                  width: 200.0,
                  height: 100.0,
                  fit: BoxFit.cover, //该属性用于在图片的显示空间和图片本身大小不同时指定图片的适应模式
                )),
            //ICON
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Icon(
                  Icons.accessible,
                  color: Colors.green,
                ),
                Icon(
                  Icons.error,
                  color: Colors.green,
                ),
                Icon(
                  Icons.fingerprint,
                  color: Colors.green,
                ),
              ],
            )
          ],
        ));
  }
}
